import service from "@/services/request";

const Api = {
  //航标数量统计
  getDataByConfigApiHBCount() {
    return new Promise((resolve) => {
      service({
        baseURL: '/',
        url: '',
        method: 'GET',
      }).then((res) => {
        resolve(res);
      });
    });
  },
  // 获取缺陷点
  getDefectivePoint() {
    return new Promise((resolve) => {
      service({
        baseURL: '/',
        url: '/iserver/services/data-pipeline2/rest/data/featureResults.json?returnContent=true',
        method: 'POST',
        data: {
          "datasetNames": [
            "pipeline_4326:QXD_POINT_1"
          ],
          "getFeatureMode": "SQL",
          "queryParameter": {
            "name": "pipeline_4326",
            "fields": ["缺陷等级"]
          },
          "maxFeatures": 200000,
          "hasGeometry": false
        }
      }).then(res => {
        resolve(res);
      })
    })
  },
  // 获取管线长度接口
  getLenOfPipline() {
    return new Promise((resolve) => {
      service({
        baseURL: '/',
        url: '/iobject/pipe_analyse/line/length',
        method: 'GET',
      }).then((res) => {
        resolve(res);
      });
    });
  },
  // 获取混节点的类型
  getMixFeature() {
    return new Promise((resolve) => {
      service({
        baseURL: '/',
        url: '/iserver/services/data-pipeline2/rest/data/featureResults.json?returnContent=true',
        method: 'POST',
        data: {
          "datasetNames": [
            "pipeline_4326:HJD_POINT_1"
          ],
          "getFeatureMode": "SQL",
          "queryParameter": {
            "name": "pipeline_4326",
            "fields": ["混节点类型"]
          },
          "maxFeatures": 200000,
          "hasGeometry": false
        }
      }).then(res => {
        resolve(res);
      })
    })
  },
  // 管线养护总数
  getTotalOfPipline() {
    return new Promise((resolve) => {
      service({
        baseURL: '/',
        url: '/admin/prod-api/event/info/eventStatistics',
        method: 'GET',
      }).then((res) => {
        resolve(res);
      });
    });
  },
  // 分析通用接口
  getAnaliseNormal({ url, data }) {
    return new Promise((resolve) => {
      service({
        baseURL: '/',
        url: url,
        method: 'POST',
        data
      }).then((res) => {
        resolve(res);
      });
    });
  },
};
window.Api = Api;
export default Api;
